package org.example.tasks;

import org.example.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledEmailTask {

    @Autowired
    private EmailService emailService;

    // 每天上午 9 点执行（Cron 表达式）(cron = "0 7 11 * * ?")
    @Scheduled(cron = "0 59 11 * * ?")
    public void sendDailyEmail() {
        String to = "3447003818@qq.com";
        String subject = "每日报告";
        String content = "这是您的每日报告内容。";
        emailService.sendEmail(to, subject, content);
    }
}
